const app = getApp()
var utils = require('../../utils/util.js');
let data = require('../../data/index.js'); 
let detaildata = require('../../data/detail.js'); 

Page({
  data: {
    housetype:true,//true为商业，false为商铺
    background: ['/images/1.jpg', '/images/2.jpg', '/images/3.jpg'],
    indicatorDots: true,
    vertical: false,
    autoplay: true,
    circular: true,
    interval: 5000,
    duration: 500,
    array: ["武汉", "洪山区", "武昌区", "江汉区"],
    typearray: ["面积", "100平以下","100-500平","500-700平","1000平以上"],
    pricearray:["价格","50元/平/月以下","50-100元/平/月","100-150元/平/月","150-200元/平/月","200元/平/月以上"],
    area: 0,
    type: 0,
    price:0,
    list: [],
    detaillist:[]
  },
  //点击商业
  chossesy:function(){
    this.setData({
      housetype: true
    })
    
    //请求后台商业列表信息接口

  },
  //点击商铺
  chossesp:function() {
    this.setData({
      housetype: false
    })
    //请求后台商铺列表信息接口
    
    this.setData({
      detaillist: detaildata.detail
    })
  },

  goToSyDetail:function(e){
    console.log('111',e.currentTarget.dataset.cap)
    const id = e.currentTarget.dataset.cap;
    //带参数跳转到详情页面
    wx.navigateTo({
      url: '/pages/projectInfo/projectInfo?id=' + id,
    })
  },
  goToSpDetail:function(e){
    console.log('商铺信息', e.currentTarget.dataset.cap)
    const id = e.currentTarget.dataset.cap;
    //带参数跳转到详情页面
    wx.navigateTo({
      url: '/pages/details/details?id=' + id,
    })
  },

  gotoSearch:function(){
    wx.navigateTo({
      url: '/pages/search/search',
    })
  },

  onLoad: function (options){
    //此处需请求后台数据
    this.setData({
      list: data.dataList
    })
  },

  bindPickerChange: function(e) {
    console.log('选择区域', e.detail.value)
    this.setData({
      area: e.detail.value
    })
    //带查询条件请求店铺列表接口
  },

  bindtypeChange: function(e) {
    console.log('选择面积', e.detail.value)
    this.setData({
      type: e.detail.value
    })
     //带查询条件请求店铺列表接口
  },

  bindpriceChange:function(e){
    console.log('选择价格', e.detail.value)
    this.setData({
      price: e.detail.value
    })
     //带查询条件请求店铺列表接口
  },

})